import re
import time
import requests
import uuid

url_page = "https://www.enterdesk.com/tag-%E8%AF%B1%E6%83%91/"
ret = requests.get(url=url_page) # ret是HTML的响应对象
# print(ret.text) # ret.text是HTML的字符串形式

url_lst = re.findall(r"https://up.enterdesk.com/edpic_360_360.*?\.jpg",ret.text)

# 1.发送请求
for url in url_lst:
    res=requests.get(url=url)
    time.sleep(3)
    # print(res)

    # 2.将响应数据转化为二进制流数据
    content=res.content

    # 3.将二进制数据流写入文件
    name=str(uuid.uuid1())+".jpg"
    with open(name,'wb') as f:
        print("正在下载%s" % name)
        f.write(content)